/* Turska UI library
 * Copyright 2003-2008 Jetro Lauha
 * All rights reserved.
 * Web: http://iki.fi/jetro/ or http://jet.ro
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of EITHER:
 *   (1) The GNU Lesser General Public License as published by the Free
 *       Software Foundation; either version 2.1 of the License, or (at
 *       your option) any later version. The text of the GNU Lesser
 *       General Public License is included with this library in the
 *       file LICENSE-LGPL.txt.
 *   (2) The BSD-style license that is included with this library in
 *       the file LICENSE-BSD.txt.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files
 * LICENSE-LGPL.txt and LICENSE-BSD.txt for more details.
 *
 * $Id: UI.h,v 1.4 2008/03/27 11:44:22 tonic Exp $
 * $Revision: 1.4 $
 */

#ifndef UI_H_INCLUDED
#define UI_H_INCLUDED


#ifdef _MSC_VER
#pragma warning(disable:4786)
#undef strdup
#define strdup _strdup
#endif // _MSC_VER

#include <set>
#include "UITypes.h"
#include "UIEventListener.h"

#include "UIImage.h"
#include "UIImageOpenGL.h"
#include "UIImageSDL.h"
//#include "UIImageIrr.h"

#include "UIGraphics.h"
#include "UIGraphicsOpenGLSDL.h"
#include "UIGraphicsOpenGLSDLCFL.h"
#include "UIGraphicsSDL.h"
#include "UIGraphicsSDLCFL.h"
//#include "UIGraphicsIrr.h"

#include "UIFont.h"
#include "UIFontOpenGLSDL.h"
//#include "UIFontSDL.h"
//#include "UIFontIrr.h"

#include "UIComponent.h"
#include "UIButton.h"
#include "UICheckBox.h"
#include "UISlider.h"
#include "UILabel.h"


class UI
{
public:

    UI(UIGraphics *graphics = NULL);
    virtual ~UI();

    void setGraphics(UIGraphics *graphics) { mGraphics = graphics; }
    UIGraphics * getGraphics() { return mGraphics; }

    //! Returns TRUE if the pointer event hits a component.
    BOOL handleUIPointerDown(INT x, INT y);
    //! Returns TRUE if some UI component was expecting a pointer up event.
    BOOL handleUIPointerUp(INT x, INT y);
    //! Returns TRUE if some UI component was expecting pointer move events.
    BOOL handleUIPointerMove(INT x, INT y);
    void addUIComponent(UIComponent *component);
    void removeUIComponent(UIComponent *component);
    void activateUIComponent(UIComponent *component);
    void deactivateUIComponent(UIComponent *component);
    void activateAllComponents();
    void deactivateAllComponents();
    void deleteAllUIComponents();

    void render();

protected:

    typedef std::set<UIComponent *> UIComponentSet;

    UIComponentSet mAllUIComponents;
    UIComponentSet mActiveUIComponents;
    UIGraphics *mGraphics;
};


#endif // !UI_H_INCLUDED
